package com.java.program_questions;

/**
 * 问题：求1+2!+3!+...+20!的和
 * 分析：此程序只是把累加变成了累乘
 */
public class Question21 {
    public static void main(String[] args) {
        long count1 = 1;
        long count2 = 0;
        for (int i = 1; i <= 20; i++) {
            for (int j = 1; j <= i; j++) {
                count1 *= j;
            }
            count2 += count1;
            count1 = 1;
        }
        System.out.print("1!+2!+……+20!=" + count2);
    }
}
